package com.cip.admin.dao.impl;

import org.hibernate.Filter;
import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.cip.admin.model.User;
import com.cip.common.util.SecurityUtil;

public class CipHibernateDAOSupport extends HibernateDaoSupport {
	
	public final HibernateTemplate getCipHibernateTemplate() throws Exception{
		  HibernateTemplate hibernateTemplate = getHibernateTemplate();
		  User user = SecurityUtil.getThreadLocalUser().get();
		  Filter filter = hibernateTemplate.enableFilter("tenantFilter");
		  filter.setParameter("tenantParam",user.getTenantId());
		  return hibernateTemplate;
	}

}
	